Welcome to Bryton in three hours.
Hello, everyone, this is a 10 tenso full across for regression neural networks.
By the end of this lecture, you will be able to develop a shallow neural network using tenso for the
cross in Python for a regression problem and also develop a deep neural network is intensive lacross
in Python for a regression problem.
OK, if you remember from the previous lectures, HaShalom neural network only has one layer of hidden
neurons, but it did not.
A network has two or more layers of hidden neurons.
We first need to import some necessarily.
There is no data, split data and calibrate data all in one cell.
So they have it all for you here in one cell.
And we are just copy and paste what we had before in the previous lectures.
Here we are importing pandas as pre and Skillern preprocessing here.
I gave it a new name, BRP.
We are loading the training and testing data of California housing, training and testing.
This guy needs to be test.
We have our training inputs and outputs, testing inputs and outputs separated.
Then we are calibrating our inputs and outputs, both of them, for training and testing.
Since this is a regression problem, we also calibrated for outputs, so just random.
So then here we're going to import a very important and popular machine learning library and that is
Stencel fellow tenso fellow is perhaps, if not the most powerful, but one of the most powerful machine
learning libraries out there for Python.
So we are importing it as the motif.
This is a very popular way of practicing it.
What if I just run this out here in this cell?
We need to define some neural network parameters for our machine learning model or neural network model.
The first thing is the total number of input neurons, and that is equal to the total number of characteristics
or attributes of our data points, which is the total number of columns of our input data points.
And that comes with the shape one or the second shape of our input calibrated data.
Also the total number of our output neurons.
And this comes with the second shape of our output of the training calibrator data.
Then here I'm going to actually define a list of the total number of neurons in different hidden layers.
And since this list has three elements, so we need for activation functions and we are defining them
here in this list of characters.
So this is the activation function corresponding to our first hidden layer, second and third layer,
and this is the activation function corresponding to the output layer.
Then we have to define the function.
And in this case we are defining miniskirted or the way we are defining it is basically the way we have
to define it for these tenths of the a library.
So we call it mean underline on error and then our optimizer.
We want it to be Adam and Toronado iterations to be 10, the size of each batch of data to be 16.
This is a shuffle variable.
The shuffle variable means that once we went through all of our training data points, then that is
one iteration is counted.
And by the start of the new iteration, we want to shuffle our training input data.
And in that case, we just minimize the possible bias of learning the order of the training data points
for our machine learning.
So each time we go through one iteration, each shuffles the data points.
So the order of our data points in our training repository going to be shuffled.
Then in order to have the outcome of each iterations to be printed for us in the output of the cell.
We have this variable, we set it to one and it basically prints for us the output of our machine learning.
But we will see this later in the next slide.
Here we are going to construct our first neural network, which is a neural network.
So in order to do that, we have to use T.F. that Kronstadt models that sequential.
And this basically creates a platform for you.
You can save it as a net or MDL.
And this platform gives you the capability to design back-to-back layers of neurons platform similar
to what you see here in these examples.
In these pictures, once we define the platform as net, we can use the function at and within the prentice's.
We are defining these different layers for the first layer.
We are adding a dense layer, which we can call it from Tefft across the layers that denotes open and
close.
Pantazis again, because this is also a function.
We define the total number of neurons here, which is for the first layer of our hidden neurons, is
actually the first value of the at least each end neurons here, which is one hundred.
But you might notice that this is not the first layer because our first layer is the input layer.
But the way the tensor flow is designed is that only for the first layer we have to define the total
number of our inputs.
The hidden layer in our first layer, which is our input dimension, which is the total number of inputs,
so we have our total number of neurons of our first layer, then an activation function, we have to
define an activation function here, which is really the first one in our, I underline fun list.
And then here we define the input dimension, which is the total number of inputs or total number of
attributes.
We have this second shape of our input, calibrated data, and that is our main underlying neurons.
But when we are adding the second hidden layer, we don't have to define the input dimension anymore
because the network automatically rated the number of hidden units in the previous layer, which is
a hidden.
We just need to define the total number of hidden neurons in that second layer and also the activation
function corresponding to that second layer, which is real.
Again, similarly defined the third a year and then eventually our last year, which is our output there
and our output there, the total number of units there is equal to the total number of output neurons,
which in this example is only one.
Our activation function is linear.
The reason we selected that activation function to be linear is because although our calibrated outputs
are between zero and one, because later we might have some testing data that might have their original
values beyond the original maximum and minimum of values of our training data.
And we might have some values in the calibrated domain in a scale of beyond zero and one, maybe less
than zero or more than one.
Then we are selecting the linear.
In that case, if we get some estimation for negative values, that is also being counted here.
So we define our mass activation function, which is corresponding to outputs.
And this is our neural network, the first network.
All we have to do here is to compile it using the net that compile function open and close.
Pantazis, you define your optimizer optimizer icons to help underline value, which is Adam, and you
also define your last function, which is miniskirted error here, such as Rudisill.
And we have this network in our workspace here.
We can't use the net that summary function open and close parentheses to see the summary of our network.
And as you see here, we have the type of our different layers, the total number of outputs of that
different figures and the total number of parameters corresponding to that different layers like weights
and biases.
So this neural network, which is a deep neural network, has a total parameters of seven thousand two
hundred and fifty one, and all of them are trainable.
Let's take a break and then continue to the next part of this lecture.